package code.google.jcontainer.event;

import code.google.jcontainer.AbstractContainer;

import java.lang.reflect.Method;

/**
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 */
public class ComponentInvocationEvent extends ContainerEvent {


    private String componentName;
    private Method method;
    private Object[] parameters;
    private Object result;

    private Throwable exception;

    public ComponentInvocationEvent(AbstractContainer container, String componentName, Method method, Object[] parameters, Object result, Throwable exception) {
        super(container);
        this.componentName = componentName;
        this.method = method;
        this.parameters = parameters;
        this.result = result;
        this.exception = exception;
    }

    public String getComponentName() {
        return componentName;
    }

    public Object getComponent() {
        return getContainer().getComponent(getComponentName());
    }



    public Method getMethod() {
        return method;
    }

    public Object[] getParameters() {
        return parameters;
    }

    public Object getResult() {
        return result;
    }

    public Throwable getException() {
        return exception;
    }
}